← Back to issue list

Snapcraft crashes when the APT unprivileged user owns the host's source list file instead of root

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1992213
Type
issue
State
open
Author
~brlin
Labels
Created
2022-10-08 02:26:38.598990+00:00
Updated
2022-10-08 02:26:39.301338+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

``` File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/cli/lifecycle.py", line 112, in _execute build_provider_class.ensure_provider() File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/internal/build_providers/_lxd/_lxd.py", line 90, in ensure_provider if repo.Repo.is_package_installed("lxd") or repo.Repo.is_package_installed( File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/internal/repo/_deb.py", line 506, in is_package_installed with AptCache() as apt_cache: File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft_legacy/internal/repo/apt_cache.py", line 58, in __enter__ self.cache = apt.Cache() File "/snap/snapcraft/8187/lib/python3.8/site-packages/apt/cache.py", line 170, in __init__ self.open(progress) File "/snap/snapcraft/8187/lib/python3.8/site-packages/apt/cache.py", line 232, in open self._cache = apt_pkg.Cache(progress) apt_pkg.Error: E:can not open /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_jammy_InRelease - fopen (13: Permission denied), E:The package lists or status file could not be parsed or opened. ``` See the attached file for full traces. It appears that the source file it reads is not world-readable, thus the error: ``` brlin@brlin-mz-530:~/文件/iscan-snap/snap$ LANG=C stat /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_jammy_InRelease File: /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_jammy_InRelease Size: 270087 Blocks: 528 IO Block: 4096 regular file Device: 1ch/28d Inode: 208286 Links: 1 Access: (0600/-rw-------) Uid: ( 105/ _apt) Gid: ( 0/ root) Access: 2022-10-08 07:10:46.083036717 +0800 Modify: 2022-04-22 01:16:39.000000000 +0800 Change: 2022-10-08 07:10:46.059036185 +0800 Birth: 2022-08-11 12:46:23.140062113 +0800 brlin@brlin-mz-530:~/文件/iscan-snap/snap$ LANG=C ls -l /var/lib/apt/lists/ ...stripped... -rw-r--r-- 1 root root 771595 Oct 6 09:36 tw.archive.ubuntu.com_ubuntu_dists_jammy-updates_universe_i18n_Translation-en -rw------- 1 _apt root 270087 Apr 22 01:16 tw.archive.ubuntu.com_ubuntu_dists_jammy_InRelease -rw-r--r-- 1 root root 6779186 Apr 19 08:52 tw.archive.ubuntu.com_ubuntu_dists_jammy_main_binary-amd64_Packages -rw-r--r-- 1 root root 4931270 Apr 19 08:52 tw.archive.ubuntu.com_ubuntu_dists_jammy_main_binary-i386_Packages ``` The `_apt` user supposed to be "unprivileged user for the apt methods"[1], whatever that means. [1]: apt - What is the sandbox user '_apt' on my system - Ask Ubuntu https://askubuntu.com/questions/810202/what-is-the-sandbox-user-apt-on-my-system

Evaluation history

No evaluation history available.